package org.yxing.palpalgps.http;

import java.util.ArrayList;

import org.apache.http.message.BasicNameValuePair;
import org.yxing.palpalgps.R;
import org.yxing.palpalgps.oauth.OAuth;
import org.yxing.palpalgps.utils.Helper;

import android.content.Context;
import android.location.Location;

/**
 * @deprecated
 * @author yuxing
 *
 */
public class FetchData {
    private Context mContext;
    
    private OAuth mOauth;
    
    public FetchData(Context context) {
        mContext = context;
        mOauth = new OAuth();
    }
    
    /**
     * @deprecated
     * fetch fired data
     * @return String
     */
    public String fetchFirend() {
        String url = Helper.getAppUrl("friend/list");
        ArrayList<BasicNameValuePair> params = mOauth.getAuthParams(null);
        return fetchData(url, params);
    }
    
    private String fetchData(String url, ArrayList<BasicNameValuePair> params) {
        return mOauth.responseData(mOauth.signRequest(url, params));
    }
    
    /**
     * @deprecated
     * @param uid
     * @return
     */
    public String fetchUserProfile(String uid) {
        ArrayList<BasicNameValuePair> params = mOauth.getAuthParams(null);
        params.add(new BasicNameValuePair("fuid", uid));
        String url= Helper.getAppUrl("profile/info");
        return fetchData(url, params);
    }
}
